import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { resolve } from 'path'
import eslintPlugin from 'vite-plugin-eslint'
// https://vitejs.dev/config/
export default defineConfig({
    build: {
        target: 'es6'
    },
    css: {
        preprocessorOptions: {
            scss: {
                prependData: '@import "~@/common/style/mixin.scss";'
            }
        }
    },
    resolve: {
        alias: [
            {
                find: '@',
                replacement: resolve(__dirname, 'src')
            }
        ]
    },
    server: {
        port: 1314,
        // 选项写法
        proxy: {
            '/orginone': {
                target: 'https://asset.orginone.cn', // 正式后台接口
                // target: 'https://orginone.cn', // 测试后台接口
                changeOrigin: true, // 是否允许跨域
                ws: true
            }
        }
    },
    plugins: [
        uni(),
        vueJsx(),
        eslintPlugin({
            cache: false
        })
    ]
})
